package com.ctcs;

import com.ctcs.filter.ConnectionAuthFilter;
import com.ctcs.listener.MyServletContextListener;

import com.ctcs.servlet.MyServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

import java.util.ArrayList;
import java.util.List;

@SpringBootApplication
@ServletComponentScan
public class MovieApplication {


	public static void main(String[] args) {
		SpringApplication.run(MovieApplication.class, args);
	}



	/* 代码配置监听器
	@Bean
	public ServletListenerRegistrationBean servletListenerRegistrationBean(){
		ServletListenerRegistrationBean servletListenerRegistrationBean = new ServletListenerRegistrationBean();
		servletListenerRegistrationBean.setListener(new MyServletContextListener());
		return servletListenerRegistrationBean;
	}*/



	/*
	代码配置过滤器
	@Bean
    public FilterRegistrationBean filterRegistrationBean() {
    FilterRegistrationBean registrationBean = new FilterRegistrationBean();
    registrationBean.setFilter(new ConnectionAuthFilter());
    List<String> urlPatterns = new ArrayList<String>();
    urlPatterns.add("*//*");
    registrationBean.setUrlPatterns(urlPatterns);
    return registrationBean;
  }*/


	/*
	代码配置Servlet
	@Bean
	public ServletRegistrationBean servletRegistrationBean() {
		return new ServletRegistrationBean(new MyServlet(), "/servlet*//*");// ServletName默认值为首字母小写，即myServlet
	}*/






}
